﻿#ifndef __DBMESSAGE_H__
#define __DBMESSAGE_H__

#include "mysqlquery.h"
#include "netlib.h"
#include "dbtypes.h"
#include <iostream>
#include <string>

/**
*@file       dbmessage.h
*@brief      sql query wrapper
*
*@author     graywind
*@version    1.0.0.5
*@data       2012/03/29
*/

/***************************************************************************************************************************/
///mysql relative macros
#define DeclareMysqlQueryPre(conn_id) \
public:\
        static MysqlService::PreStmtPtr stmt;\
private:\
    static bool m_bIsInit;\
    static bool InitFunc(const std::string& sqlsentence)\
    {\
            if(PreStmtInitializer::HasInstance() == false)\
                   PreStmtInitializer::Create();\
            PreStmtInitializer::Instance()->Add(conn_id, stmt, sqlsentence);\
            return true;\
    }\


#define ImplMysqlQueryPre(type, sql) \
    MysqlService::PreStmtPtr type::stmt = MysqlService::PreStmtPtr();\
    bool type::m_bIsInit = type::InitFunc(sql);\


#endif